1 Public Class FrmPOSSTOCKSLIST
2
3     Private Sub cmdcancel_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdcancel.Click
4         Me.Close()
5     End Sub
6
7     Private Sub FrmPOSSTOCKSLIST_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
8         txtsearch.Text =
""
9         With FrmPOS_CHOICES
10             If .rbdefect.Checked Then
11                 txtsearch.Enabled = False
12                 lststocks.Items.Clear()
13                 sqlSTR =
"SELECT TBL_Pending_Item.Pending_ID AS 'Pending ID', TBL_category_item_file.item_id AS 'ID', Replace(Replace(TBL_Category_Item_File.Item_name,'$.$',''''),'$..$',',') as 'Name', " & _
14                          
"TBL_Category_Item_File.Item_Description as 'Description / Item Number', TBL_Category_Item_File.item_price as 'Price', " & _
15                          
"TBL_Deffective_PO_Return_Details.Return_QTY - TBL_Sales_Sold_Detail.Added_QTY as 'Quantity' " & _
16                          
"FROM TBL_Pending_Item " & _
17                          
"INNER JOIN TBL_Deffective_PO_Details ON TBL_Pending_Item.Pending_ID = TBL_Deffective_PO_Details.Pending_ID " & _
18                          
"INNER JOIN TBL_Deffective_PO_Return ON TBL_Deffective_PO_Details.DEF_PO_ID = TBL_Deffective_PO_Return.DEF_PO_ID " & _
19                          
"INNER JOIN TBL_Deffective_PO_Return_Details ON TBL_Deffective_PO_Return.Return_ID = TBL_Deffective_PO_Return_Details.Return_ID " & _
20                          
"INNER JOIN TBL_Sales_Receipt ON TBL_Sales_Receipt.Receipt_ID = TBL_Pending_Item.Receipt_ID " & _
21                          
"INNER JOIN TBL_Sales_Sold_Detail ON TBL_Sales_Receipt.Sales_ID = TBL_Sales_Sold_Detail.Sales_ID " & _
22                          
" AND TBL_Sales_Sold_Detail.Sales_Detail_ID = TBL_Pending_Item.Sales_Detail_ID " & _
23                          
"INNER JOIN TBL_Category_Item_File ON TBL_Deffective_PO_Details.Item_ID = TBL_Category_Item_File.Item_ID " & _
24                          
"WHERE TBL_Pending_Item.Receipt_ID =" & FrmPOSVIEW.txtreceiptid.Text & " AND Returnx ='No'"
25                 FillListView(ExecuteSQLQuery(sqlSTR), lststocks,
0)
26             Else
27                 lststocks.Items.Clear()
28                 txtsearch.Enabled = True
29                 sqlSTR =
"SELECT TBL_category_item_file.item_id AS 'ID', Replace(Replace(TBL_Category_Item_File.Item_name,'$.$',''''),'$..$',',') as 'Name', TBL_Category_Item_File.Item_Description as 'Description / Item Number', TBL_Category_Item_File.item_price as 'Price', TBL_Stocks_Balances.Item_QTY as 'Quantity' " & _
30                          
"FROM TBL_category_item_file INNER JOIN TBL_Stocks_Balances ON TBL_Category_Item_File.Item_ID = TBL_Stocks_Balances.Item_ID "
31                 FillListView(ExecuteSQLQuery(sqlSTR), lststocks,
1)
32             End If
33         End With
34     End Sub
35
36     Private Sub cmdselect_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdselect.Click
37         With FrmPOSADD
38             If lststocks.Items.Count >
0 Then
39                 lststocks.Focus()
40                 If FrmPOS_CHOICES.rbdefect.Checked Then
41                     .txtpendingID.Text = lststocks.FocusedItem.Text
42                     .txtid.Text = lststocks.FocusedItem.SubItems(
1).Text
43                     .txtname.Text = lststocks.FocusedItem.SubItems(
2).Text
44                     .txtdesc.Text = lststocks.FocusedItem.SubItems(
3).Text
45                     .txtprice.Text = lststocks.FocusedItem.SubItems(
4).Text
46                     .txt_QTYi.Text = lststocks.FocusedItem.SubItems(
5).Text
47                     .txtqty.Text = lststocks.FocusedItem.SubItems(
5).Text
48                 ElseIf FrmPOS_CHOICES.rbNew.Checked Then
49                     .txtid.Text = lststocks.FocusedItem.Text
50                     .txtname.Text = lststocks.FocusedItem.SubItems(
1).Text
51                     .txtdesc.Text = lststocks.FocusedItem.SubItems(
2).Text
52                     .txtprice.Text = lststocks.FocusedItem.SubItems(
3).Text
53                     .txt_QTYi.Text = lststocks.FocusedItem.SubItems(
4).Text
54                     .txtqty.Text = lststocks.FocusedItem.SubItems(
4).Text
55                 End If
56                 .ShowDialog()
57             End If
58         End With
59         Me.Close()
60     End Sub
61
62     Private Sub txtsearch_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles txtsearch.TextChanged
63         With FrmPOS_CHOICES
64             If .rbNew.Checked Then
65                 sqlSTR =
"SELECT TBL_category_item_file.item_id AS 'ID', Replace(Replace(TBL_Category_Item_File.Item_name,'$.$',''''),'$..$',',') as 'Name', TBL_Category_Item_File.Item_Description as 'Description / Item Number', TBL_Category_Item_File.item_price as 'Price', TBL_Stocks_Balances.Item_QTY as 'Quantity' " & _
66                          
"FROM TBL_category_item_file " & _
67                          
"INNER JOIN TBL_Stocks_Balances ON TBL_Category_Item_File.Item_ID = TBL_Stocks_Balances.Item_ID " & _
68                          
"WHERE TBL_Category_Item_File.Item_Name LIKE '%" & R_eplace(txtsearch.Text) & "%'"
69                 FillListView(ExecuteSQLQuery(sqlSTR), lststocks,
1)
70             End If
71         End With
72     End Sub
73 End Class


Gõ tìm kiếm nhanh...